package cn.com.cetccst.datacenter.policy.entity;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.ColumnInfo;

import java.util.Objects;

public class ComplianceBase {

    public static final int ACTION_SKIP = 0;
    public static final int ACTION_WARN = 1;
    public static final int ACTION_QUIT = 2;
    public static final int ACTION_UN_ENROLL = 3;
    public static final int ACTION_FACTORY_RESET = 4;
    public static final int ACTION_LOCK = 5;
    public static final int ACTION_FACTORY_RESET_NOT_INCLUDED = 6;

    public static final int STATUS_PASS = 0;
    public static final int STATUS_VIOLATED = 1;


    @NonNull
    @ColumnInfo(name = "key")
    private String key;
    @ColumnInfo(name = "status", defaultValue = "0")
    private int status;
    @ColumnInfo(name = "punish", defaultValue = "1")
    private int punish;

    //TODO 考虑添加违规详情

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public int getPunish() {
        return punish;
    }

    public void setPunish(int punish) {
        this.punish = punish;
    }

    @Override
    public boolean equals(@Nullable Object obj) {
        if(obj instanceof ComplianceBase compliance) {
            return Objects.equals(key, compliance.key) &&
                    status == compliance.getStatus() &&
                    punish == compliance.getPunish();
        }
        return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(key, status, punish);
    }
}
